# import boto3
# import sys
# import csv

# es2client = boto3.client('ec2')

# # lb_name = sys.argv[1]
# # tg_name = sys.argv[2]
# # tg_port = int(sys.argv[3])


# def getec2info(privat_ip_adderss):
#     describe_instances = es2client.describe_instances(
#         Filters=[
#             {
#                 'Name': 'network-interface.addresses.private-ip-address',
#                 'Values': [
#                     privat_ip_adderss,
#                 ]
#             },
#         ],
#     )
#     return describe_instances['Reservations'][0]['Instances'][0]['InstanceId']


# if __name__ == "__main__":

#     # ip = '10.8.1.101'
#     # print(getec2info(ip))

#     with open('data.csv') as readdata:
#         reader_from_csv = csv.reader(readdata)
#         rownum = 1
#         with open('result.csv', 'a+', newline='') as writedata:
#             writer_to_csv = csv.writer(writedata)
#             for row in reader_from_csv:
#                 if '-app-' in row[3]:
#                     host_name = row[3]
#                     if rownum > 9:
#                         rowstr = str.format("Host-{}", rownum)
#                     else:
#                         rowstr = str.format("Host-0{}", rownum)
#                     if '.184' not in row[4] and '.185' not in row[4]:
#                         instanceid = getec2info(row[4])
#                     row[0] = rowstr
#                     row[1] = instanceid
#                     writer_to_csv.writerow(row)
#                     rownum += 1
#                     print(str.format("获取ID{}成功", row[3]))
#                 else:
#                     writer_to_csv.writerow(row)
#                     print("这是ELB，无需获取")
